program example
  use mod_fftw
  implicit none
  integer::i,j
  integer,parameter::N=1000,M=200

  real(8),dimension(M,N):: in2d,ain
  complex(8),dimension(M/2 + 1, N) ::out2d,aout


  !The data in the in/out arrays is overwritten during FFTW_MEASURE planning, 
  !so such planning should be done before the input is initialized by the user.    

  call dfftw_init(M,N,in2d,out2d)

  do i=1,N
     do j=1,M
        in2d(j,i)=(i*j)
     enddo
  enddo



  call dfftw_r2c(in2d, out2d)
 
  call dfftw_c2r(in2d, out2d)


  call dfftw_destroy()

  write(*,*)in2d(1,1)

endprogram example

